<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<title>Search Page</title>
<link href="/InfoPlatform/MainPage/homepage_files/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/InfoPlatform/MainPage/homepage_files/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/InfoPlatform/MainPage/homepage_files/css/wj_style.css" rel="stylesheet" type="text/css">
<link href="/InfoPlatform/MainPage/homepage_files/css/datepicker.css" rel="stylesheet" type="text/css">
<style type="text/css">
.sidebar-nav {
	padding: 9px 0;
}
</style>
</head>

<body>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container"> <a class="brand" href="#">WSU online</a>
  <form class="navbar-form pull-left">
  <div class="input-append">
    <input type="text" class="search span4" placeholder="Search">
    <button type="submit" class="btn">Search</button>
    
    </div>
  </form>
  <!--</form>-->
  <a class="btn btn-info pull-left" href="#" style="margin-left:40px;"><i class="icon-download-alt icon-white"></i> APPDownload</a> 
      <!--</form>-->
      <s:if test="#session.email==null">
      <form class="navbar-form pull-right"action = "UserManager!SearchLoginSystem" method = "post">
        <input class="span2" type="text" placeholder="User Email" name = "email">
        <input class="span2" type="password" placeholder="Password" name = "password">
        <button type="submit" class="btn btn-primary">Log in</button>
        <button type="submit" class="btn" data-toggle="modal" href="#register">register</button>
      </form>
	  </s:if>
      <s:else>
      <form class="navbar-form pull-right">
                <div class="btn-group">
          <a class="btn btn-primary" href="#"><i class="icon-user icon-white"></i>&nbsp;${email}</a>
          <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="./PersonalPage.jsp"><i class="icon-home"></i>&nbsp;Personal Page</a></li>
            <li><a type="submit" data-toggle="modal" href="#modify"><i class="icon-edit"></i>&nbsp;Complete My Information</a></li>
            <li><a href="#"><i class="icon-edit"></i>&nbsp;modify user information</a></li>
            <li><a href="#"><i class="icon-shopping-cart"></i>&nbsp;My Second Hand</a></li>
             <li><a href="#"><i class="icon-flag"></i>&nbsp;My Activities</a></li>
             <li><a href="#"><i class="icon-resize-small"></i>&nbsp;My Asking for Help</a></li>
            <li class="divider"></li>
            <li><a href="UserManager!OutSystem.action"><i class="i"></i>&nbsp;Log out</a></li>
          </ul>
        </div>
      </form>
	 </s:else>	
</div></div>
</div>
<div class="modal hide fade" style="display: none;" id="register">
  <div class="modal-header">
    <h3>Register</h3>
  </div>
  <div class="modal-body">
    <form action = "UserManager!Register" method = "post">
      <p>User Name</p>
      <input type="text" class="span3" placeholder="Please insert use rname..." name = "name">
      <span class="help-inline wj-sub-font-color">6~18 characters，please begin with a letter</span>
      <p>Password</p>
      <input type="password" class="span3" placeholder="Please insert the password..." name = "password">
      <span class="help-inline wj-sub-font-color">6~16 characters</span>
      <p>Verify password</p>
      <input type="password" class="span3" placeholder="Please insert the password again...">
      <p>E-mail</p>
      <input type="text" class="span3" placeholder="Please insert the email..." name = "email">
      <span class="help-inline wj-sub-font-color">used for finding password</span>
      <label>Sex</label>
      <select name = "sex">
        <option value="M">Male</option>
        <option value="F">Female</option>
      </select>
       <div class="modal-footer"> <a class="btn" data-dismiss="modal">Cancel</a>  <input type="submit" class="btn btn-primary" value="register"/></div>
    </form>
  </div>
 </div>
 
 <s:if test="#session.email!=null">
 <div class="modal hide fade" style="display: none;" id="modify">
  <div class="modal-header">
    <h3>Complete My Information</h3>
  </div>
  <div class="modal-body" >
    <form action = "UserManager!UpdateInfo">
      <p>Phone</p>
      <input type="text" class="span3" placeholder="Please insert phone number..." name = "phone">
      <span class="help-inline wj-sub-font-color">11numbers</span>
      <p>微博</p>
      <input type="text" class="span3" placeholder="请输入微博账号..." name = "weibo">
      <span class="help-inline wj-sub-font-color">微博账号</span>
      <p>address</p>
      <input type="text" class="span3" placeholder="Please insert address..." name = "address">
      <span class="help-inline wj-sub-font-color">Be specific</span>
	  <label>College</label>
      <select name = "college">
        <option value = "Software">College of Software Engineering</option>
        <option value = "Computer">College of Computer Science</option>
      </select>
	  
		<label>Major</label>
      <select name = "major">
        <option value = "se">Software Engineering</option>
        <option value = "cs">Computer Science</option>
      </select>
	  <p>Grade</p>
	   <input type="text" class="span3" placeholder="Please insert grade..." name = "grade">
      <span class="help-inline wj-sub-font-color">which grade you in</span>
	  <p>Hobby</p>
	  	<input type="checkbox" name="second_c" value="1"> Second Hand
		<input type="checkbox" name="activity_c" value="2"> Activity  
		<input type="checkbox" name="help_c" value="3"> Ask for Help
	  <div class="modal-footer"> <a class="btn" data-dismiss="modal">Cancel</a>  <input type="submit" class="btn btn-primary" value="Complete"/></div>
    </form>
  </div>
</div>
 </s:if>
<!--/.nav-collapse -->
<div class="container wj-roll">
  <div class="row-fluid">
       <div class="span3">
      <div class="well sidebar-nav">
        <ul class="nav nav-list">
          <li class="nav-header">My Second Hand</li>
          <li><a href="Secondary!SearchPage?secondaryTag=book">Books</a></li>
          <li><a href="Secondary!SearchPage?secondaryTag=sport">Sport</a></li>
          <li><a href="Secondary!SearchPage?secondaryTag=transport">Transport</a></li>
          <li><a href="Secondary!SearchPage?secondaryTag=digital">Digital</a></li>
          <li><a href="Secondary!SearchPage?secondaryTag=other">Others</a></li>
          <li class="nav-header">My Activities</li>
          <li><a href="Activity!personalActivity?activityTag=preach">Preach</a></li>
          <li><a href="Activity!personalActivity?activityTag=academic">Academic</a></li>
          <li><a href="Activity!personalActivity?activityTag=bulletin">Bulletin</a></li>
          <li><a href="Activity!personalActivity?activityTag=lecture">Lecture</a></li>
          <li><a href="Activity!personalActivity?activityTag=entertainment">Entertainment</a></li>
          <li class="nav-header">My Asking for Help</li>
         <li><a href="Help!personalHelp?helpTag=study">Ask for Studying</a></li>
          <li><a href="Help!personalHelp?helpTag=sport">Ask for Sport</a></li>
          <li><a href="Help!personalHelp?helpTag=fun">Ask for Entertainment</a></li>
          <li><a href="Help!personalHelp?helpTag=food">Ask for Delicious Food</a></li>
        </ul>
      </div>
      <!--/.well --> 
    </div>
    <div class="span9"> 
    <div class="well span12" style="padding-top:5px; padding-bottom:5px;">
    <a class="btn disabled btn-info">sort</a><a class="btn" style="margin-left:5px;" href="#">sort by default&nbsp;</a><a class="btn" style="margin-left:5px; padding-right:0px;" href="#" onClick="changearrow('follownum')">Number of interests&nbsp;<i class="icon-arrow-down" id="follownum" style=" margin-left:-3px; margin-right:0px;"></i>&nbsp;</a>
    <a class="btn" style="margin-left:10px; padding-right:0px;" href="#" onClick="changearrow('price')">Price&nbsp;<i id="price" class="icon-arrow-down" style=" margin-left:-3px; margin-right:0px;"></i>&nbsp;</a>
    <div class="wj-float-right">
    <a class="btn disabled" style="padding-left:4px; padding-right:4px;"><i class="icon-chevron-left"></i></a>
    1/99
    <a class="btn" style="padding-left:4px; padding-right:4px;"><i class="icon-chevron-right"></i></a></div>
    </div>
    
    </div>
    <!--./span9-->
    <div class="span9">
     <ul class="wj-zero-margin">
      <s:iterator value = "searchResult.keySet()" id = "index" >
      <s:iterator value="searchResult.get(#index)">
    	 <li class="wj-full-width wj-clear-float-left wj-item-margin">
            <hr class="wj-line-margin wj-clear-float-left">
            <div class="row-fluid wj-block">
			<div class="span2"><a href="Secondary!SearchCommodityById?commodityId=<s:property value='commodityId'/>"><img class=" wj-full-width wj-zero-margin pull-right" src="<s:property value="picture"/>"></a></div>
			<div class="span10">
				<p><h3 class="wj-font-normal-weight"><a href="#"><s:property value="#index"/>:</a>published<a href="Secondary!SearchCommodityById?commodityId=<s:property value='commodityId'/>"><s:property value="name"/></a></h3></p>
				<p>Details<s:property value="detail"/>...</p>
				<small class=" badge "><s:property value="publicTime"/></small><small class=" badge badge-info" style="margin-left:5px;">Already has<s:property value="attentionCount"/>people interested in this</small><small class="pull-right btn btn-mini">interested</small>
				<small class="pull-right btn btn-warning btn-mini" style="margin-right:3px;">Details</small>
			</div>
			</div>
          </li>  
          </s:iterator>
   </s:iterator>
         
          <li class="wj-full-width wj-clear-float-left wj-item-margin">
          <hr class="wj-line-margin wj-clear-float-left">
          
          	<div class="pagination pagination-right">
 			 <ul>
   				 <li><a href="#">←</a></li>
   				 <li class="active"><a href="#">1</a></li>
    			<li><a href="#">2</a></li>
    			<li><a href="#">3</a></li>
    			<li><a href="#">4</a></li>
    			<li><a href="#">5</a></li>
    			<li class="disabled"><a href="#">...</a></li>
   				<li><a href="#">→</a></li>
  			</ul> 
			</div>

          </li>
        </ul>
    </div>
  </div>
  <hr>
  <p class="wj-footer">Copyright <a href="#">WSU online</a> All Rights Reserved. Powered by <a href="#">WSU</a>.</p>
</div>
<!-- Le javascript
    ================================================== --> 
<!-- Placed at the end of the document so the pages load faster --> 
<script language="javascript" src="homepage_files/js/jquery.js"></script> 
<script language="javascript" src="homepage_files/js/bootstrap.js"></script> 
<script language="javascript" src="homepage_files/js/wj.js"></script> 
<script language="javascript" src="homepage_files/js/bootstrap-datepicker.js"></script>
<script language="javascript">
function changearrow(a){
if(document.getElementById(a).className=="icon-arrow-down")
document.getElementById(a).className="icon-arrow-up";
else
document.getElementById(a).className="icon-arrow-down";
}
</script>
</body>
</html>
